package com.lingchou.cloud.process.api.dto.param;

import com.lingchou.cloud.process.api.enums.ProcessNodeTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.groups.Default;
import java.time.LocalDateTime;
import java.util.List;

@Getter
@Setter
@ApiModel(value = "ProcessNode", description = "流程定义链表")
public class ProcessNode {

    /**
     * 审批人列表
     */
    @ApiModelProperty(value = "审批人列表", required = true)
    @NotNull(message = "人员列表必传")
    @NotEmpty(message = "人员列表不能为空")
    private List<String> userIds;

    /**
     * 节点类型
     */
    @ApiModelProperty(value = "节点类型", required = true)
    @NotNull(message = "节点类型不能为空")
    private ProcessNodeTypeEnum nodeType;

    /**
     * 选人范围
     */
    @ApiModelProperty(value = "选人范围", required = true)
    @NotBlank(message = "选人范围不能为空")
    private String selectionRange;

    /**
     * 节点名称
     */
    @ApiModelProperty(value = "节点名称",required = true)
    @NotBlank(message = "节点名称不能为空")
    private String nodeName;

    /**
     * 定时时间
     */
    @ApiModelProperty(value = "定时时间，要求ISO8601",required = true)
    @NotNull(message = "定时时间不能为空",groups = Dynamic.class)
    private LocalDateTime endTime;

    /**
     * 当需要此分组与Default同时生效，只需继承javax.validation.groups.Default
     */
    public interface Dynamic extends Default {}

}
